package ch.unisi.inf.pfii.teamwhite.risk.graphic.menuFrame.dialogs;

/**
 * 
 * @author Matteo Bellan: bellanm@lu.unisi.ch
 * @author Andrea Michelotti: micheloa@lu.unisi.ch
 * @author Ranganathan Ramasubramanian: ramasubr@lu.unisi.ch@lu.unisi.ch
 *
 */

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;

import ch.unisi.inf.pfii.teamwhite.risk.graphic.menuFrame.MenuFrame;

public class CreditsDialog extends JDialog{
	
	public CreditsDialog(MenuFrame menuFrame) {
		
		
		setLayout(new BorderLayout(2, 1));
		
		add(makeText(), BorderLayout.CENTER);
		add(makeOk(), BorderLayout.SOUTH);
		
		setTitle("Credits");
		setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
		setResizable(false);
		setVisible(true);
		setSize(642, 550);
		setLocationRelativeTo(menuFrame);
	}
	
	private Component makeText() {
		ImageIcon image = new ImageIcon(getClass().getResource("credits.png"));
		JLabel credits = new JLabel(image);
		add(credits);
		
		return credits;
	}
	
	private Component makeOk() {
		JButton ok = new JButton("OK");
		ok.addActionListener(new ActionListener() {
            public void actionPerformed(final ActionEvent ev) {
            	setVisible(false);
            }
		});
		return ok;
	}
}
